package com.xique.door.project.miniprogram.controller;

import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.door.project.miniprogram.bean.request.MiniChooseCommunityRequest;
import com.xique.door.project.miniprogram.biz.service.IMiniHomeBizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author shd
 * @create 2022/4/12 16:49
 */
@RestController
@RequestMapping("/home")
public class MiniHomeController extends BaseController {

    @Autowired
    private IMiniHomeBizService homeBizService;

    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo() {
        return homeBizService.getBaseInfo();
    }

    @GetMapping("/communityList")
    public AjaxResult communityList(String areaCode) {
        return homeBizService.getCommunityList(areaCode);
    }

    @PostMapping("/chooseCommunity")
    public AjaxResult chooseCommunity(@RequestBody @Valid MiniChooseCommunityRequest request) {
        return homeBizService.chooseCommunity(request);
    }
}
